import os
import django
import sqlite3

import numpy as np
import pandas as pd
import pymysql


def insert_data():
    # TODO 将数据插入数据库
    pymysql.install_as_MySQLdb()
    day_data = pd.read_csv('../data/day_data.csv')
    month_data = pd.read_csv('../data/month_data.csv')
    pd.set_option('display.max_columns', None)
    conn = "mysql+pymysql://{}:{}@{}:{}/{}".format('root', '123456', 'database', '3306', 'tq')
    conn = sqlite3.connect('../../sqlite3.db')
    day_data['id'] = np.nan
    day_data.to_sql('day_data', conn, index=False, if_exists='append')
    pass


if __name__ == '__main__':
    insert_data()
